﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DbDoc;
namespace DbDoc.BusinessObjects
{
    [Serializable()]  
    public class Database :DbObject
    {
        #region Member Variables
        private IList<Table> _Tables = new List<Table>();
        private IList<View> _Views = new List<View>();
        private IList<StoredProc> _Procs = new List<StoredProc>();
        private IList<Function> _Functions = new List<Function>();
        #endregion

        #region Properties
        public IList<Table> Tables
        {
            get { return _Tables; }
            set { _Tables = value; }
        }        

        public IList<View> Views
        {
            get { return _Views; }
            set { _Views = value; }
        }        

        public IList<StoredProc> Procs
        {
            get { 
                return _Procs; }
            set { _Procs = value; }
        }        

        public IList<Function> Functions
        {
            get { return _Functions; }
            set { _Functions = value; }
        }

        public override  DbType DbType
        {
            get { return DbType.Database; }
        }

        public override IEnumerable<DbObject> Children
        {
            
            get {
                List<DbObject> objs = new List<DbObject>();
                objs.AddRange(_Tables);
                objs.AddRange(_Procs);
                return objs.Cast<DbObject>(); }
        }

        public  IEnumerable<DbObject> ProcsList
        {
            get { return _Procs.Cast<DbObject>(); }
        }

        #endregion

        #region Methods
        public static IList<Database> GetDatabases()
        {            
            return null;
        }

        public override void Save()
        {
           
        }
        #endregion
    }
}
